﻿Public Partial Class QuizControl
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    ''' <summary>
    ''' Cleans the quiz name removing html encoded characters
    ''' </summary>
    ''' <param name="nm"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function CleanName(ByVal nm As String) As String
        Dim retVal As String
        retVal = nm
        retVal = Replace(retVal, "&trade;", "")
        retVal = Replace(retVal, "&reg;", "")

        Return retVal
    End Function

    ''' <summary>
    ''' creates the link to the edit page
    ''' </summary>
    ''' <param name="qid"></param>
    ''' <param name="qnm"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function EditLink(ByVal qid As Integer, ByVal qnm As String) As String
        Dim retVal As String
        Dim cln As String
        cln = CleanName(qnm)
        retVal = "<a href=""AddEditQuizQuestions.aspx?qid=" & qid & "&qnm=" & cln & """>add/edit</a>"

        Return retVal
    End Function
End Class